<?php

/**
 * This is the model class for table "epay_transaction".
 *
 * The followings are the available columns in table 'epay_transaction':
 * @property string $transaction_id
 * @property string $transaction_network_id
 * @property string $transaction_products_id
 * @property string $transaction_ppob_refid
 * @property string $transaction_ppob_produk
 * @property string $transaction_ppob_idpelanggan
 * @property string $transaction_ppob_namapelanggan
 * @property string $transaction_ppob_jumlahtagihan
 * @property string $transaction_ppob_jumlahadm
 * @property string $transaction_ppob_jumlahbayar
 * @property string $transaction_ppob_refnumber
 * @property string $transaction_ppob_pesan
 * @property string $transaction_ppob_status
 * @property string $transaction_ppob_code
 * @property string $transaction_ppob_rpcid
 * @property string $transaction_datetime
 */
class epay_transaction extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return epay_transaction the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'epay_transaction';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('transaction_network_id', 'length', 'max'=>20),
			array('transaction_products_id, transaction_ppob_jumlahtagihan, transaction_ppob_jumlahadm, transaction_ppob_jumlahbayar', 'length', 'max'=>10),
			array('transaction_ppob_refid, transaction_ppob_produk, transaction_ppob_idpelanggan, transaction_ppob_namapelanggan, transaction_ppob_refnumber, transaction_ppob_status, transaction_ppob_code, transaction_ppob_rpcid', 'length', 'max'=>50),
			array('transaction_ppob_pesan', 'length', 'max'=>255),
			array('transaction_datetime', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('transaction_id, transaction_network_id, transaction_products_id, transaction_ppob_refid, transaction_ppob_produk, transaction_ppob_idpelanggan, transaction_ppob_namapelanggan, transaction_ppob_jumlahtagihan, transaction_ppob_jumlahadm, transaction_ppob_jumlahbayar, transaction_ppob_refnumber, transaction_ppob_pesan, transaction_ppob_status, transaction_ppob_code, transaction_ppob_rpcid, transaction_datetime', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
            'rel_epay_products' => array(self::BELONGS_TO, 'epay_products', 'transaction_products_id'),
        );
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'transaction_id' => 'Transaction',
			'transaction_network_id' => 'Transaction Network',
			'transaction_products_id' => 'Transaction Products',
			'transaction_ppob_refid' => 'Transaction Ppob Refid',
			'transaction_ppob_produk' => 'Transaction Ppob Produk',
			'transaction_ppob_idpelanggan' => 'Transaction Ppob Idpelanggan',
			'transaction_ppob_namapelanggan' => 'Transaction Ppob Namapelanggan',
			'transaction_ppob_jumlahtagihan' => 'Transaction Ppob Jumlahtagihan',
			'transaction_ppob_jumlahadm' => 'Transaction Ppob Jumlahadm',
			'transaction_ppob_jumlahbayar' => 'Transaction Ppob Jumlahbayar',
			'transaction_ppob_refnumber' => 'Transaction Ppob Refnumber',
			'transaction_ppob_pesan' => 'Transaction Ppob Pesan',
			'transaction_ppob_status' => 'Transaction Ppob Status',
			'transaction_ppob_code' => 'Transaction Ppob Code',
			'transaction_ppob_rpcid' => 'Transaction Ppob Rpcid',
			'transaction_datetime' => 'Transaction Datetime',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('transaction_id',$this->transaction_id,true);
		$criteria->compare('transaction_network_id',$this->transaction_network_id,true);
		$criteria->compare('transaction_products_id',$this->transaction_products_id,true);
		$criteria->compare('transaction_ppob_refid',$this->transaction_ppob_refid,true);
		$criteria->compare('transaction_ppob_produk',$this->transaction_ppob_produk,true);
		$criteria->compare('transaction_ppob_idpelanggan',$this->transaction_ppob_idpelanggan,true);
		$criteria->compare('transaction_ppob_namapelanggan',$this->transaction_ppob_namapelanggan,true);
		$criteria->compare('transaction_ppob_jumlahtagihan',$this->transaction_ppob_jumlahtagihan,true);
		$criteria->compare('transaction_ppob_jumlahadm',$this->transaction_ppob_jumlahadm,true);
		$criteria->compare('transaction_ppob_jumlahbayar',$this->transaction_ppob_jumlahbayar,true);
		$criteria->compare('transaction_ppob_refnumber',$this->transaction_ppob_refnumber,true);
		$criteria->compare('transaction_ppob_pesan',$this->transaction_ppob_pesan,true);
		$criteria->compare('transaction_ppob_status',$this->transaction_ppob_status,true);
		$criteria->compare('transaction_ppob_code',$this->transaction_ppob_code,true);
		$criteria->compare('transaction_ppob_rpcid',$this->transaction_ppob_rpcid,true);
		$criteria->compare('transaction_datetime',$this->transaction_datetime,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}